using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System;

using MyUtils;

namespace Test.MyUtils.WeakDelegate
{
	public class SimpleEventPublisher : EventPublisher
	{
		public event Action EventSimple;

		public override int EventSimpleSubscribers
		{
			get
			{
				if (EventSimple == null)
				{
					return 0;
				}
				return (int)EventSimple.Reflect("GetInvocationList.Length");
			}
		}

		public void OnEventSimple()
		{
			var handler = EventSimple;
			if (handler != null)
			{
				handler();
			}
		}
	}
}